﻿package mortal.game.view.levelReward.cellrender
{
    import com.mui.controls.*;
    import com.mui.utils.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.item.*;

    public class LevelRewardGiftListCellRender extends GCellRenderer
    {
        public var _item:BaseItem;
        private var _itemData:ItemData;

        public function LevelRewardGiftListCellRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._item = UICompomentPool.getUICompoment(BaseItem);
            this._item.setItemStyle(ItemStyleConst.Small, ImagesConst.PackItemBg, 2, 2);
            this.addChild(this._item);
            this._item.isDragAble = false;
            this._item.isShowLock = true;
            this._item.isBind = true;
            this._item.isShowColorBg = false;
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._itemData = param1 as ItemData;
            if (this._itemData)
            {
                this._item.itemCode = this._itemData.serverData.itemCode;
                if (this._itemData.serverData.itemCode < 1000)
                {
                    this._item.toolTipData = GameDefConfig.instance.getEPrictUnitName(this._itemData.serverData.itemCode) + this._itemData.extData["num"];
                }
                this._item.amount = this._itemData.extData["num"] as int;
            }
            else
            {
                this._item.itemData = null;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._item.dispose();
            this._item = null;
            this._itemData = null;
            return;
        }// end function

    }
}
